package com.example.medicine.Mapper;

import com.example.medicine.Bean.SystemFunction;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SystemFunctionMapper {

    @Select("select Name from [SystemFunction] where ID=#{ID}")
    String getNameById(String ID);

    @Select("select ID from [SystemFunction] where Name=#{Name}")
    String getIdByName(String Name);

    @Select("select * from [SystemFunction]")
    List<SystemFunction> getAll();


    /**
     * 向Team表中插入团队名称，医生姓名，电话
     */
    @Insert("insert into [SystemFunction](ID, ParentID,  Name,URL,Remark) values(newid(),'24341BBB-223F-4C4F-8B06-06BA47DE2ACC', #{Name},#{URL},#{Remark})")
//    @Options(useGeneratedKeys = true,keyProperty="id")
    void insert(SystemFunction systemfunction);

    /**
     * 更新Team表，根据主键（ID）
     * 团队名称，医生姓名，电话
     * @param
     */
    @Update("update [SystemFunction] set Name=#{Name}, URL=#{URL}, Remark=#{Remark} where ID=#{ID}")
    void update(SystemFunction systemfunction);

    /**
     * 根据id删除Team表中记录
     * @param id
     */
    @Delete("delete from [SystemFunction] where ID=#{ID}")
    void deleteById(String id);

    @Select("select * from [SystemFunction] where ID=#{ID}")
    SystemFunction getById(String id);
}
